package bpm.dao.impl.document;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.BatchPreparedStatementSetter;

import bpm.domain.document.DocumentEntry;
/**
 * 
 * @author ZhaoWangLong Jul 26, 2011
 *
 */
public class DocumentEntryBatchPreparedStatement implements
		BatchPreparedStatementSetter {
	private List<DocumentEntry> entrys;
	
	public DocumentEntryBatchPreparedStatement(List<DocumentEntry> entrys){
		this.entrys=entrys;
	}
	public DocumentEntryBatchPreparedStatement(){}
	public int getBatchSize() {
		return entrys.size();
	}
	public void setValues(PreparedStatement ps, int i) throws SQLException {
		ps.setString(1, entrys.get(i).getDocumentId());
		ps.setString(2, entrys.get(i).getFieldKey());
		ps.setString(3, entrys.get(i).getValue());
		ps.setTimestamp(4, new java.sql.Timestamp(entrys.get(i).getLastUpdateTime().getTime()));
		ps.setString(5, entrys.get(i).getDescription());
		ps.setString(6, entrys.get(i).getId());
	}

}
